﻿using System;
using System.Collections.Generic;
using System.Text;
using System.Web.Security;
using FFIV.Lib.DataComponent.UserDSTableAdapters;

namespace FFIV.Lib.BusinessRules
{
	internal class UserRules
	{
		internal static MembershipUser RegisterProcess(string UserName, string Password, string Comment)
		{
			MembershipUser user = Membership.CreateUser(UserName, Password, UserName);
			user.Comment = Comment;
			Membership.UpdateUser(user);
			Roles.AddUserToRole(UserName, "author");
			return user;
		}

		internal static string GetUserRoleByUserId(Guid UserId)
		{
			string RoleId;
			using (QueriesTableAdapter adapter = new QueriesTableAdapter())
			{
				RoleId = adapter.GetUserRoleByUserId(UserId).ToString();
			}
			return RoleId;
		}
	}
}
